package com.ssy.lingxi.member.merchant.controller;

import com.ssy.lingxi.member.merchant.model.constant.MemberValidateHistoryOperationEnum;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

/**
 * 会员服务状态接口
 * @author 万宁
 * @version 2.0.0
 * @date 2020-05-29
 */
@RestController
@RequestMapping("/member")
public class StatusController {
    @RequestMapping("/status")
    public String status() {
        return "ok";
    }

    public static void main(String[] args) throws IOException {
        String filepath = "d:/messages.properties";

        List<String> content = new ArrayList<>();
        for (MemberValidateHistoryOperationEnum value : MemberValidateHistoryOperationEnum.values()) {
            String key = value.getClass().getName();
            content.add(key.substring(key.lastIndexOf(".") + 1).concat(".").concat(String.valueOf(value.getCode())).concat("=").concat(value.getMsg()));
        }

        content.add("");



        Files.write(Paths.get(filepath), content, StandardCharsets.UTF_8);
    }
}
